package cn.xyinping.basic.util;

import lombok.Data;

/**
 * @author 27266
 * @desrciption ajax请求
 * @date 2021/10/20
 */
@Data
public class AjaxResult {
    // 操作状态
    private Boolean success = true;
    // 操作结果
    private String message = "操作成功";
    // 返回给前端路径
    private Object resultObj;
    // 静态方法用类调用 方法连载
    public static AjaxResult me(){
        return new AjaxResult();
    }

    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }

    public AjaxResult setMessage(String message) { // 错误就走这个方法
        this.success = false;
        this.message = message;
        return this;
    }

    public AjaxResult setResultObj(Object resultObj) {
        this.resultObj = resultObj;
        return this;
    }
}
